package com.zmm.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmm.weblog.common.domain.dos.UserRoleDo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Author:福禄寿
 * @Date:2024/4/29 下午1:20
 * @Des:weblog-springboot
 **/
@Mapper
public interface UserRoleMapper extends BaseMapper<UserRoleDo> {

    /**
     * 根据用户名查询用户角色信息
     * @param username
     * @return
     */
    default List<UserRoleDo> selectByUsername(String username) {
        LambdaQueryWrapper<UserRoleDo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserRoleDo::getUsername, username);
        return selectList(wrapper);
    }
}
